home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 1 Issue 2 / PDCD-1 - Issue 02.iso / _utilities / utilities / 004 / fsck / hard_help < prev    next >
Text File  |  1994-10-06  |  9KB  |  234 lines

  1. hardfix (1.00) - heavily damaged disc fixer
  2.  
  3. NOTE: this program is SHAREWARE. Read the !SHAREWARE file for more info.
  4.  
  5. hardfix is a disc utility that fixes the errors that can affect the boot
  6. block, the 2 copies of the map and the root directory without having to scan
  7. the whole directory tree. These sort of errors generally make the disc
  8. un-readable or un-writable!
  9. hardfix can also be used to write the bootblock, map and root directory to a 
  10. file, so that you can always try to restore them in case they are totally 
  11. damaged (ie. absolutely unfixable).
  12.  
  13.  
  14. Usage
  15. -----
  16.  
  17. hardfix [-options] [-[s|r] savefile] [-l logfile] pathname
  18.   -l   print the results in "logfile"
  19.   -s   save bootblock/map/root sectors to "savefile"
  20.   -r   restore bootblock/map/root sectors from "savefile"
  21.   -Q   ask before fixing
  22.  -1/-2 force to fix the first/second copy of the map
  23.  
  24. If the disc is readable, pathname can contain the disc name (eg.
  25. IDEFS::IDEDisc4.$), otherwise it must contain the disc number (eg.
  26. IDEFS::4.$).
  27.  
  28.  
  29. When you need to use it
  30. -----------------------
  31.  
  32. hardfix should not be used regularly like fsck, since the errors it fixes are
  33. usually really uncommon. Moreover fsck recognises most of the errors hardfix
  34. cures and tells you when it is needed.
  35. Anyway, you can use it regularly to save the important disc data (ie.
  36. bootblock, map and root) to a file, so that you will be able to restore them
  37. if they are completely destroyed for some mysterious reason. Moreover, you
  38. are adviced to save them before trying to fix the map with fsck or with
  39. hardfix itself: if the fix is wrong (especially if it aggravates the
  40. situation!), you can always restore your old data.
  41. Remember that restoring old maps generally causes many file corruptions! In
  42. fact, the map is costantly updated while files are saved/deleted, and even
  43. files that are not updated can be automatically moved around by RISC OS.
  44. If your map is broken, try to fix it with fsck and hardfix and eventually 
  45. restore an old one only if you are sure there is nothing better to do!
  46.  
  47.  
  48. The fixable errors
  49. ------------------
  50.  
  51. hardfix is able to fix the following errors:
  52. - bootblock checksum wrong
  53. - bootblock defect list end marker missing
  54. - bootblock defect list checksum wrong
  55. - map cross check wrong
  56. - map copies different
  57. - zone checksum wrong (this is the typical cause of unreadable discs)
  58. - zone free chunk offset wrong
  59. - zone free linked list wrong (this is the typical cause of unwritable discs)
  60. - zone not correctly terminated
  61. - root directory identifiers wrong
  62. - root checksum wrong
  63. - root master sequence numbers different
  64. - root endmarker wrong
  65. The bootblock errors should never appear, unless your disc is *really*
  66. damanged and will probably be useless to try to fix it. If you never had
  67. problems with your disc but hardfix wants to fix the bootblock, *don't* fix
  68. it! Probably your disc has been formatted by some strange program but if it
  69. works don't try to change it! You have been warned! Eventually try to contact
  70. the author (sending a saved file and a logfile) that will investigate the
  71. problem.
  72. The map errors are the most common, especially the ones about free lists, but
  73. can usually be successfully cured.
  74. The root directory errors are generally serious since they usually imply that
  75. the directory has been completely overwritten. In this case the only choice
  76. is to restore it from a previously saved file (only the root should be
  77. restored, not the bootblock and map, too!).
  78. Using the -Q option you will be asked to choose if the error(s) has to be
  79. fixed or left intact. So you can choose to fix only the map and not the
  80. bootblock.
  81. You will always be asked if the fixes has to be applied to the disc (ie. if
  82. you really want to save the fixed bootblock, map and root directory).
  83.  
  84.  
  85. The logfile
  86. -----------
  87.  
  88. Using the logfile (-l) option is generally really useful: if something
  89. strange happens, the author will be more helpful if he can see exactly what
  90. happened and you don't even have to try to explain what happened when you run
  91. hardfix, the logfile and the saved disc data is usually enough!
  92. The logfile contains exactly what it is printed to the screen, so it should
  93. be really small (nearly 1K on a good disc or nearly 5K on a quite corrupted
  94. one). 
  95. You cannot save the logfile to the disc to fix!
  96. If a file with the same name of the logfile already exists, the new data will
  97. be attached at the end of it: in this way, you can attach together two or
  98. more logfiles.
  99.  
  100.  
  101. Notes
  102. -----
  103.  
  104. If the two copies of the map are different, hardfix tries to fix the less
  105. damaged. If they are apparently damaged at the same level, hardfix will ask
  106. you which map to fix. In normal cases, you are adviced to fix the map that
  107. hardfix suggests or, by default, choose the first one.
  108. The -1 and -2 options can be used to force hardfix to try to fix the first or
  109. the second copy, regardless of their state.
  110.  
  111.  
  112. Saved file format
  113. -----------------
  114.  
  115. This is only of interest to people who wants to access to the saved file in
  116. their own programs (probably nobody!).
  117. The saved file has a header that contains the filesystem informations
  118. followed by a series of tagged object.
  119. The header consists of the filesystem name followed by a newline and then the
  120. disc number followed by another newline.
  121. Each tagged object consists of a textual tag of 4 bytes followed by the
  122. object itself. The currently recognised tags are:
  123. "BOOT" - bootblock (512 bytes)
  124. "MAP1" - the first copy of the map (the length can be calculated from the
  125.          bootblock data)
  126. "MAP2" - the second copy of the map (the same length as the first copy)
  127. "ROOT" - the root directory (2048 bytes)
  128. "RSiX" - the RISCiX partition table (only if RISCiX partitioned!) (256 bytes)
  129.  
  130. The bootblock must always come before the map, otherwise the length of the
  131. map cannot be calculated. Only 800K floppies have no bootblock: in this case 
  132. the length of the map is 1024 bytes.
  133. The second copy of the map must always follow the first one.
  134. Any other tag is ignored and the file is scanned until a recognised tag is
  135. found. The tags should be word aligned (the alignement refers to the first
  136. tag even if it isn't actually word aligned inside the file because of the
  137. filesystem name).
  138.  
  139.  
  140. Disclaimer
  141. ----------
  142.  
  143. hardfix can be considered a really dangerous program since it can directly
  144. write to the bootblock, map and root directory: these are the key sectors of
  145. a disc, damaging them can result in the complete or partial loss of the data
  146. on the disc.
  147. I tried most of the features of hardfix on my disc and on some floppies but I 
  148. cannot be completely sure it will work on your disc, too. Always save the
  149. data using the -s option before trying to fix the disc and remember that it's 
  150. generally better not to fix the bootblock. 
  151. Anyway, if something goes wrong, I am sorry for you but I AM NOT RESPONSIBLE 
  152. for any loss of data on your discs, so use hardfix at your own risk.
  153.  
  154.  
  155. Limitations
  156. -----------
  157.  
  158. I think that hardfix is able to cure almost every 'fixable' error: this means
  159. that it cannot fix a completely damaged disc (ie. if both copies of the map
  160. are overwritten by some random data it can't do nothing apart from restoring
  161. a saved file).
  162. The only map error it cannot fix is removing an ID that is not sector-aligned
  163. (ie. it starts/ends in the middle of a sector).
  164. hardfix cannot join two adjacent free chunks, too, but I don't think this is
  165. a problem.
  166. Both these limitations will hopefully be fixed in future versions.
  167.  
  168.  
  169. Bugs
  170. ----
  171.  
  172. If your disc is RISCiX partitioned, the bootblock checksum will not be
  173. calculated. This should not be generally considered a problem, though.
  174. More important, I am not fully sure about the map in RISCiX partitioned
  175. discs, so, if hardfix wants to fix a map that seems to be good (try CheckMap
  176. and fsck on it) don't let it write the map back to disc!
  177.  
  178.  
  179. Results achieved up to now
  180. --------------------------
  181.  
  182. If you run hardfix on your corrupted HD, please let me know! If it wasn't
  183. able to fix it, I'll try to modify it to cope with your problem. If you want
  184. to stay anonymous tell me not to include your name.
  185.  
  186. Positive results:
  187.  1) some 800K ADFS floppy (used during development).
  188.  2) my 16Mb IDE that I damaged just to see if hardfix worked on it!
  189.  3) 203Mb IDE. Owner: L. Domisse
  190.  4) 87Mb SCSI (Lingenuity interface). Owner: S. Kock
  191.  
  192. I don't think that hardfix will ever have a long list of fixed disc...
  193.  
  194. Negative results:
  195.  No negative results till now. 
  196.  
  197.  
  198. History
  199. -------
  200.  
  201. 1.00   First released version.
  202.  
  203.  
  204. Thanks go to:
  205. -------------
  206.  
  207. - Laurent Domisse who pushed me to write this program to fix his unreadable
  208.   disc (and then unwritable, too!)
  209. - Hans Ole Rafaelsen who tried hardfix on 1.6Mb floppies.
  210.  
  211.  
  212. Conditions of use
  213. -----------------
  214.  
  215. hardfix can only be distributed with the complete fsck suite.
  216. Read the !SHAREWARE file for the conditions of use and distribution of the
  217. whole package.
  218.  
  219.  
  220. I can be contacted at the following address:
  221.  
  222. Sergio Monesi
  223. Via Trento e Trieste 30
  224. 20046 Biassono (MI)
  225. Italy
  226.  
  227. E-mail address:
  228. pel0015@cdc8g5.cdc.polimi.it
  229. If you don't receive a reply (or if the message is bounced) I can also be
  230. contacted at:
  231. sergio@phantom.com
  232. or:
  233. sergio@g386bsd.first.gmd.de
  234.